FROM php:7.4.16-fpm-alpine3.13
RUN sed -i 's!https://dl-cdn.alpinelinux.org/!https://mirrors.aliyun.com/!g' /etc/apk/repositories && \
    apk add --update --no-cache \
    libgd libpng-dev libjpeg-turbo libjpeg-turbo-dev jpeg-dev freetype-dev libxml2-dev \
    icu-dev libzip-dev openssl-dev libxslt-dev msmtp && \
    docker-php-ext-configure gd --with-freetype --with-jpeg && \
    docker-php-ext-configure intl && \
    docker-php-ext-configure zip && \
    docker-php-ext-configure pdo_mysql && \
    docker-php-ext-install -j "$(nproc)" gd intl zip pdo_mysql simplexml soap xsl bcmath sockets && \
    echo $'sendmail_from=mstmp\n\
sendmail_path=/usr/bin/msmtp -t\n\
SMTP=mailcatcher\n\
smtp_port=1025\n' >> /usr/local/etc/php/conf.d/sendmail.ini && \
    echo $'account mailcatcher\n\
host mailcatcher\n\
port 1025\n\
auto_from on\n\
account default: mailcatcher\n' >> /etc/msmtprc && \
    echo $'memory_limit=2G' > /usr/local/etc/php/php.ini
VOLUME [ "/var/www/html" ]
WORKDIR /var/www/html